<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<ul id="cintainer">
		<li>1</li>
		<li>2</li>
		<li>3</li>
		<li>4</li>
		<li>5</li>
	</ul>

	<script type="text/javascript" src="demo01.js"></script>
	<script type="text/javascript">
		// 测试
		var demo = new Iterator('li', 'container');

		// 例1：获取元素
		console.log(demo.first());
		console.log(demo.pre());
		console.log(demo.next());
		console.log(demo.get(2000));

		// 例2：处理元素
		demo.dealEach(function(text, color) {
			this.innerHTML = this.innerHTML + ' ' + text;
			this.style.background = color;
		}, 'test', 'pink');

		// 例3：排他处理
		demo.exclusive([2, 3], function() {
			this.innerHTML = '被排除的';
			this.style.background = 'orange';
		}, function() {
			this.innerHTML = '选中的';
			this.style.background = 'red';
		});
	</script>
</body>
</html>